﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Maticsoft.DBUtility;
using System.Data.SqlClient;
using System.Collections;
using System.Data;

namespace RLZY.others
{
    class key
    {
        /// <summary>
        /// 公积金账号存在
        /// </summary>
        public SqlDataReader GetListGJJ(string 公积金,int  id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");

            strSql.Append(" 公积金号 from GZ  where  公积金号=@公积金号");


            strSql.Append(" and  是否保护='否' and id<>@id ");

            SqlParameter[] param = new SqlParameter[] 
            { 
                new SqlParameter("@公积金号",公积金),
                new SqlParameter("@id",id),
               
            };

            return DbHelperSQL.ExecuteReader(strSql.ToString(), param);

        }
        /// <summary>
        /// 医疗保险账户账号存在
        /// </summary>
        public SqlDataReader GetListYLBX(string 医疗保险号, int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");

            strSql.Append(" 医疗保险号 from GZ  where  医疗保险号=@医疗保险号");


            strSql.Append(" and  是否保护='否' and id<>@id ");

            SqlParameter[] param = new SqlParameter[] 
            { 
                new SqlParameter("@医疗保险号",医疗保险号),
                new SqlParameter("@id",id),
               
            };

            return DbHelperSQL.ExecuteReader(strSql.ToString(), param);

        }
        /// <summary>
        /// 日期段固定项显示
        /// </summary>
        public DataSet GetDateGDX(string QX, String BZ, DateTime start, DateTime end)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select *");

            strSql.Append(" FROM GZ ");
            strSql.Append("  where 1=1 and (部门单位 like '%'+@strWhere+'%' or @strWhere='') and (车间班组 like '%'+@strWhere1+'%' or @strWhere1='')");
            strSql.Append("  and 日期>=@起始日期 ");

            strSql.Append("  and 日期<=@截止日期 ");
            strSql.Append("  order   by  ID desc ");

            SqlParameter[] param = new SqlParameter[] 
            { 
                new SqlParameter("@strWhere",QX),
                new SqlParameter("@strWhere1",BZ),
                new SqlParameter("@起始日期",start),
                new SqlParameter("@截止日期",end),
            };

            return DbHelperSQL.Query(strSql.ToString(), param);

        }

    }
}
